import { commonTableOptions } from '@/utils/util'

export function formOption() {
  let self = this

  return {
    submitBtn: false,
    emptyBtn: false,
    span: 24,
    labelWidth: 120,
    labelPosition: 'right',
    gutter: 24,
    detail: true,
    // disabled: self.disabled,
    column: [
      {
        label: '告警类型',
        prop: 'type',
        disabled: true,
        row: true,
        type: 'select',
        // dicData: self.$store.getters["dict/getDictByCode"]("warning_model"),
        dicData: self.warnModuleArr
      },
      {
        label: '告警等级',
        prop: 'level',
        disabled: true,
        row: true,
        type: 'select',
        dicData: [
          {
            label: '一级告警',
            value: '1'
          },
          {
            label: '二级告警',
            value: '2'
          },
          {
            label: '三级告警',
            value: '3'
          }
        ]
      },
      {
        label: '通信方式',
        prop: 'pushWay',
        disabled: true,
        row: true,
        type: 'select',
        dicData: [
          { label: '移动网络', value: '1' },
          { label: '卫星', value: '2' }
        ]
      },
      {
        label: '船舶名称',
        prop: 'shipName',
        disabled: true,
        row: true
      },
      {
        label: '视频点位',
        prop: 'videoPoints',
        display: !self.isSysAutoWarn,
        disabled: true,
        row: true
        // type: 'select',
        // dicData: self.$store.getters['dict/getDictByCode']('installation_point')
      },
      {
        label: '船企名称',
        prop: 'tenantName',
        disabled: true,
        row: true
      }
    ]
  }
}

export function tableOption() {
  let self = this
  return {
    ...commonTableOptions,
    menu: false,
    // height: self?.documentHeight - 230,
    // dialogCustomClass: "crud-dialog",
    selection: false,
    // selectionWidth: 70,
    // selectionFixed: true,
    column: [
      {
        label: '告警照片',
        prop: 'fileAddress',
        hide: false,
        overHidden: false,
        searchOrder: 1,
        width: 400
      },
      {
        label: '拍摄时间',
        search: false,
        prop: 'shootingTime',
        hide: false,
        overHidden: true,
        formatter: (row) => {
          return row.shootingTime || '--'
        }
      },
      {
        label: '拍摄位置',
        prop: 'shootingPosition',
        hide: false,
        searchOrder: 0,
        searchOrder: 13,
        formatter: (row) => {
          return row.shootingPosition || '--'
        }
      },
      {
        label: '船舶状态',
        prop: 'shipStatus',
        hide: false,
        searchOrder: 2,
        overHidden: true,
        dicData: [
          {
            label: '在船',
            value: 0
          },
          {
            label: '锚泊',
            value: 1
          },
          {
            label: '靠泊',
            value: 2
          }
        ],
        formatter: (row) => {
          const res = [
            {
              label: '在航',
              value: 0
            },
            {
              label: '锚泊',
              value: 1
            },
            {
              label: '靠泊',
              value: 2
            }
          ]
          return (res.find((i) => i.value == row.shipStatus) && res.find((i) => i.value == row.shipStatus).label) || row.shipStatus || '--'
        }
      },

      {
        label: '船首向',
        search: false,
        prop: 'voyageInitialDirection',
        hide: false,
        overHidden: true,
        formatter: (row) => {
          return row.voyageInitialDirection ? `${row.voyageInitialDirection}°` : '--'
        }
      },

      {
        label: '航速',
        search: false,
        prop: 'voyageSpeed',
        hide: false,
        overHidden: true,
        formatter: (row) => {
          return row.voyageSpeed > 0 ? row.voyageSpeed + '节' : `0节`
        }
      },

      {
        label: '航向',
        searchLabelWidth: 60,
        prop: 'voyageCurrentDirection',
        hide: false,
        search: false,
        formatter: (row) => {
          return row.voyageCurrentDirection ? `${row.voyageCurrentDirection}°` : '--'
        }
      }
    ]
  }
}
export function affirmativeOption() {
  const self = this
  return {
    ...commonTableOptions,
    menu: false,
    index: false,
    header: false,
    column: [
      {
        label: '累计确警反馈（次）',
        prop: 'confirmTotal',
        overHidden: true
      },
      {
        label: '周期内确警反馈（次）',
        prop: 'confirmCount',
        overHidden: true
      },
      {
        label: '周期内平均确警时效（分钟）',
        prop: 'averageConfirmationTime',
        overHidden: true
      },
      {
        label: '周期内确警超时（次）',
        prop: 'confirmTimeoutCount',
        overHidden: true
      },
      {
        label: '确警超时率',
        prop: 'confirmTimeoutRate',
        overHidden: true
      }
    ]
  }
}
export function dealOption() {
  const self = this
  return {
    ...commonTableOptions,
    menu: false,
    index: false,
    header: false,
    column: [
      {
        label: '累计处理告警（次）',
        prop: 'handleTotal',
        overHidden: true
      },
      {
        label: '周期内处理告警（次）',
        prop: 'handleCount',
        overHidden: true
      },
      {
        label: '周期内平均处理时效（分钟）',
        prop: 'averageHandleTime',
        overHidden: true
      },
      {
        label: '周期内处理超时（次）',
        prop: 'handleTimeoutCount',
        overHidden: true
      },
      {
        label: '处理超时率',
        prop: 'handleTimeoutRate',
        overHidden: true
      }
    ]
  }
}
export function falseAlarmOption() {
  const self = this
  return {
    ...commonTableOptions,
    menu: false,
    index: false,
    header: false,
    column: [
      {
        label: '累计误报警（次）',
        prop: 'errorWarningTotal',
        overHidden: true
      },
      {
        label: '周期内误报警（次）',
        prop: 'errorWarningCount',
        overHidden: true
      },
      {
        label: '误警率',
        prop: 'errorRate',
        overHidden: true
      }
    ]
  }
}
